package com.iris.live.services.common.reconsitution;

/**
 * yitianle
 * 分页帮助
 * 2017/2/13.
 */
public class PageUtil {

    /**
     * 取得分页查询的起始记录
     * @param currentPage
     * @param pageSize
     * @return
     */
    public static Integer getPage(Integer currentPage, Integer pageSize){
        if (currentPage >0) {
            currentPage = currentPage -1;
        }

        Integer startNum = 0;
        startNum = currentPage * pageSize;
        return startNum;
    }


    /**
     * 取得总页数
     * @param totalNum
     * @param pageSize
     * @return
     */
    public static Integer getTotalPage(Integer totalNum , Integer pageSize){
        Integer page = 0;
        page =(totalNum-1)/pageSize+1;
        return page;
    }

}
